package org.ko.core.dao.auth.impl;


import org.apache.commons.lang3.StringUtils;
import org.ko.core.dao.auth.RoleDao;
import org.ko.core.dao.hibernate4.BaseTypedDao;
import org.ko.core.dao.support.Finder;
import org.ko.core.domain.auth.Role;
import org.ko.core.websupport.page.Page;
import org.springframework.stereotype.Repository;



/**
 * 系统角色管理DAO接口实现
 * @author BQC
 * @version 2014-09-14 15:24:26
 */
@Repository
public class RoleDaoImpl extends BaseTypedDao<Role, Long> implements RoleDao{

	@Override
	protected Class<Role> getEntityClass() {
		return Role.class;
	}

	@Override
	public Page findPage(int pageNo, int pageSize,String searchText) {
		Finder f = Finder.create("FROM Role where 1=1 ");
		if(StringUtils.isNotBlank(searchText)){
			f.append(" and (name like :searchText )");
			f.setParam("searchText", "%"+searchText+"%");
		}
		return find(f, pageNo, pageSize);
	}

}